1. Technical Field
The invention relates to technologies for achieving automation of orientation work at the preceding stage of making three-dimensional measurement from different camera positions, automatic acquisition of initial values for stereo matching, and automation of the three-dimensional measurement.
2. Prior Art
In performing three-dimensional measurement in close-range photogrammetry the measurement is carried out through the flow of processes as shown in FIG. 1. Namely, it is required to perform processes of taking a pair of stereo images of a subject (a)xe2x86x92position detection (b)xe2x86x92orientation (c)xe2x86x92stereo model formation (d)xe2x86x92three-dimensional measurement (e). Although these processes are performed mainly by operations of a computer, the processes of the position detection (b) and the three-dimensional measurement (e) have so far been performed manually. The position detection (b) is a preprocess of the orientation, which is a process to obtain position, inclination, and the like of the cameras for taking images.
By obtaining the relative position between the cameras and the subject in the process of the orientation (c), it becomes possible to form a stereo model providing a stereo view and achieve the three-dimensional measurement. The process of the position detection (b) preceding the orientation (c) is such work as to obtain coordinate positions, on each camera, of six or more corresponding points taken by separate cameras.
In the three-dimensional measurement (e), there are two kinds: point measurement and planar measurement.
In the case of the point measurement, the point to be measured on the subject is generally measured manually. However, when automatic measurement is planned or improvement in accuracy is desired, it is practiced to glue a mark onto the subject.
In the case of the planar measurement, automatic measurement is carried out by using a method of stereo matching through image processing. Then, however, it was required to make such initial setting as determination of a template image and setting up of the searched width through manual work.
In the work of the position detection (b), the operator selects six or more points of measurement on the subject in the left and right images and, while observing each image, correlates the points of measurement on the subject with each other and detects the coordinates of the positions. However, since the operator basically had to do such work while taking a stereo view, it required skill and, in addition, it was complicated, difficult, and problematic.
Especially, in such work as to correlate the left and right images with each other upon determination of the points of measurement and detect the detailed coordinates of the positions, personal errors were liable to occur, results were different from operator to operator, and sufficient accuracy was difficult to obtain. There were even cases where such measurement was unachievable by some operators. To obviate the difficulties, such a method as to glue a mark onto the subject is sometimes practiced.
However, it is an unfavorable thing for such work as gluing a mark onto the subject to increase, and there are even such cases where, depending on the subjects, gluing a mark onto the subject is very difficult. Therefore, this method has not come into wide use.
There is also such a method to perform three-dimensional measurement with two cameras firmly fixed onto a stereo pan tilt head thereby eliminating the orientation work.
In this case, however, there should absolutely be no deviation in the relative position between two cameras on the pan tilt head, and therefore the measurement environment and the subject for measurement are greatly limited. At the same time, such apparatus becomes large, heavy, and difficult to handle and, besides, expensive. Hence, this method also is not used so widely.
Further, in the point measurement in the three-dimensional measurement (e), when a mark or the like is not glued onto the subject for measurement, the operator had to indicate the point of measurement while observing the taken image in the course of the measurement. Therefore, much labor and time were required when there were many points of measurement. Further, when it was attempted to make precise measurement, personal errors were liable to occur and, in the worst case, measurement itself became unachievable.
Such things as described above can be obviated if measurement is carried out after gluing a mark onto a subject, but in that case, as described above, the labor for attaching the mark was newly required and, depending on the subjects, it was difficult to glue a mark onto the subject and sometimes it became impossible to make measurement.
In the case of the planar measurement, it was required to manually make such work as to determine the template image and determine an optimum searched width as a preprocess in making automatic measurement through stereo matching. Further, when mismatched points or the like occurred, correction had to be made manually. Thus, it was difficult to realize automation.
It is an object of the invention to provide a shape measuring apparatus. an image measuring apparatus, and an image forming apparatus capable of performing the processes from the orientation work to the three-dimensional measurement automatically, effectively and precisely.
A preferred shape measuring apparatus according to the invention comprises a characteristic pattern extracting portion, in accordance with a pair of first images of a subject for measurement having characteristic patterns serving as references provided thereon in different angles and a pair of second images of the subject for measurement having no characteristic patterns serving as references provided thereon in the same angles as with the first images, for calculating the difference between the first image and the second image taken in each direction thereby obtaining the characteristic patterns, positional relationship calculating portion for obtaining a positional relationship between the pair of the first images or the pair of the second images on the basis of the difference images obtained in the characteristic pattern extracting portion, a stereo model forming portion, in accordance with the positional relationship obtained in the positional relationship calculating portion, for mutually relating the fist images or the second images so that a stereo model capable of being stereoscopically viewed is formed, and a shape measuring portion for obtaining the shape of the subject in accordance with the stereo model formed in the stereo model forming portion.
The characteristic pattern extracting portion can be adapted to extract the characteristic pattern image through comparison of the difference image constituted of the difference between the first image and the second image taken in each direction with a reference characteristic pattern image previously stored.
The characteristic pattern extracting portion can be adapted to extract the characteristic pattern image through comparison, according to a template matching method, of the difference image constituted of the difference between the first image and the second image taken in each direction with a reference characteristic pattern image previously stored.
The characteristic pattern extracting portion can be adapted to extract the characteristic pattern image first by making coarse detection according to a template matching method and then making precise detection by applying predetermined processing to an image in the vicinity of a characteristic pattern.
A preferred image forming apparatus for shape measurement according to the invention comprises a characteristic pattern forming portion for selectively forming characteristic patterns serving as references on a subject for measurement and an image forming portion for taking an image of a subject for measurement having characteristic patterns serving as references provided thereon in different directions thereby obtaining a pair of first images and taking an image of the subject for measurement having no characteristic patterns serving as references provided thereon in the same directions as with the first images thereby obtaining a pair of second images.
The characteristic pattern forming portion can be constituted of a characteristic pattern projecting portion for selectively projecting characteristic patterns serving as references onto a subject for measurement.
A preferred image measuring apparatus according to the invention comprises an approximate position measuring portion for approximately obtaining, from a pair of images of a subject for measurement in different directions, positional information of the subject for measurement in each of the images, a data setting portion, having one image of the pair of images set as a reference image and the other image as a searched image, for setting up, in accordance with the positional information obtained in the approximate position measuring portion, reference data blocks in the reference image and setting up searched areas in the searched image and searched data blocks in the searched area, and a correspondence determining portion for obtaining correspondence between the searched data block set up in the searched area and the reference data block. The data setting portion, in accordance with the positional information obtained in the approximate position measuring portion, performs at least either setting up of the reference data blocks in the reference image or setting up of the searched areas and setting up of the searched data blocks in the searched image.
The pair of images include a characteristic pattern image of which positional information is previously known and the approximate position measuring portion can be adapted, in accordance with the position of the characteristic pattern image in the reference image and the positional information of the characteristic pattern image in the searched image, to approximately obtain the positional information of the subject for measurement in each of the pair of images.
The data setting portion can be adapted to set up the range of the searched area in the searched image in accordance with the position of the characteristic pattern image in the searched image.
The data setting portion can be adapted to set up the range of the searched area in the searched image in accordance with its relationship with the position of the characteristic pattern image and the position of the searched area in the searched image or with the position of the characteristic pattern image and the position of the reference data block in the reference image.
The data setting portion can be adapted to set up the magnitude of the range of the searched area in the searched image in accordance with its relationship with the position of the characteristic pattern image and the position of the searched area in the searched image or with the position of the characteristic pattern image and the position of the reference data block in the reference image.
The data setting portion can be adapted to set up in the searched image the range of the searched area having a larger width or area according as the characteristic pattern image and the searched area in the searched image, or the characteristic pattern image and the reference data block in the reference image, are more distant from each other.
The data setting portion can be adapted to set up a plurality of searched areas differing in size.
The data setting portion can be adapted to set up the reference data block in the reference image in accordance with the position of the characteristic pattern image in the reference image.
The data setting portion can be adapted to set up the magnitude of the reference data block in the reference image in accordance with the position of the characteristic pattern image and the position of the reference data block in the reference image.
The data setting portion can be adapted to set up in the reference image the reference data block larger in height or width according as the position of the characteristic pattern image and the position of the reference data block in the reference image are more distant from each other.
The data setting portion can be adapted to set up a plurality of reference data blocks differing in size in accordance with the characteristic pattern image in the reference image.